<?php $__env->startSection('content'); ?>
    <nav class="breadcrumb">
        <i class="Hui-iconfont">&#xe67f;</i>
        当前位置: <span class="c-gray en">&gt;</span>
        游戏管理 <span class="c-gray en">&gt;</span>
        游戏列表
    </nav>
    <div class="page-container">
        <div class="text-c">
            <form action="" method="get">
                游戏名称：
                <input type="text" name="app_name" id="app_name"
                       value="<?php echo e($query['app_name']); ?>"
                       placeholder="" style="width:100px" class="input-text">
                <span class="select-box inline">
                手机平台：
                    <select name="platform" class="select">
                        <option value="0">--请选择--</option>
                        <option value="1" <?php if($query['platform'] == 1): ?> selected <?php endif; ?>>android</option>
                        <option value="2" <?php if($query['platform'] == 2): ?> selected <?php endif; ?>>ios</option>
                        <option value="3" <?php if($query['platform'] == 3): ?> selected <?php endif; ?>>h5</option>
                    </select>
                </span>
                <button name="" id="" class="btn btn-success" type="submit">查询</button>
                <a class="btn btn-info" style="line-height:1.6em;margin-top:3px" id="btn-refresh" href="javascript:;" onclick="location.replace('<?php echo e(url('nonPublicVersion/game')); ?>')" title="重置" >重置</a>
            </form>
        </div>


        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <span class="r">
                <a class="btn btn-primary radius"
                   data-title="新增" onclick="openDialog('','<?php echo e(url('nonPublicVersion/game/create')); ?>','','',true)" href="javascript:;">
                    新增
                </a>
                <a class="btn btn-primary radius"
                   data-title="新增" onclick="del()" href="javascript:;">
                     删除
                </a>
            </span>
            
        </div>
        <div class="mt-20">
            <table class="table table-border table-bordered table-bg table-hover table-sort">
                <thead>
                <tr class="text-c">
                    <th width="25"><input type="checkbox" name="" value=""></th>
                    <th width="30">序号</th>
                    <th width="50">游戏ID</th>
                    <th>游戏名称</th>
                    <th width="80">手机平台</th>
                    <th width="75">渠道分包列表</th>
                    <th width="75">备注</th>
                    <th width="50">是否我方SDK</th>
                    <th width="100">操作</th>
                </tr>
                </thead>
                <tbody>
                        <?php $__currentLoopData = $lists; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $list): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr class="text-c">
                                <td><input type="checkbox" value="<?php echo e($list->game_id); ?>" name="ids[]"></td>
                                <td><?php echo e($key + 1); ?></td>
                                <td><?php echo e($list->game_id); ?></td>
                                <td class="text-l"><?php echo e($list->app_name); ?></td>
                                <td><?php echo e($list->platform); ?></td>
                                <td>
                                    <a style="text-decoration:none" class="ml-5" onClick="openDialog('','<?php echo e(url('nonPublicVersion/gamePackage/' . $list->game_id. '/edit')); ?>','','',true)" href="javascript:;" title="游戏渠道打包列表">
                                        <?php echo e(0); ?>

                                    </a>
                                </td>
                                <td><?php echo e($list->note); ?></td>
                                <td>是</td>
                                <td class="f-14 td-">
                                    <a style="text-decoration:none" class="ml-5"
                                       onClick="deleteChannel('<?php echo e($list->id); ?>')" href="javascript:;" title="删除">删除</a>

                                    <a style="text-decoration:none" class="ml-5" onClick="openDialog('','<?php echo e(url('nonPublicVersion/game/' . $list->game_id. '/edit')); ?>','','',true)" href="javascript:;" title="编辑">
                                        编辑</a>
                                    <a style="text-decoration:none" class="ml-5"
                                       onClick="openDialog('',
                                               '<?php echo e(url('nonPublicVersion/gamePackage/' . $list->game_id,[
                                               'game_name'=>$list->app_name,
                                               'supplier_name'=> '无合作游戏供应商',
                                               'platform'=>$list->platform,
                                               ])); ?>','','',true)"
                                       href="javascript:;"
                                       title="打包">打包
                                    </a>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
            <div id="page"  class="r" style="margin-top: 20px;"></div>

            <div  class="r" style="margin-top: 20px;">
                
                <span class="l">
                    每页显示:<input type="text" id="paginate" value="10" class="input-text" style="width: 30px;margin-left: 20px;height: 28px;">
                                        <input type="button" class="btn go" value="GO" style="width: 50px;height: 28px;">
                </span>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script type="application/javascript">
    laypage({
        cont: $('#page'), //容器。值支持id名、原生dom对象，jquery对象。【如该容器为】：&lt;div id="page1">&lt;/div>
        pages: '<?php echo e($lists ? $lists['totalPage'] : 0); ?>', //通过后台拿到的总页数
        curr: '<?php echo e($lists ? $lists['current_page'] : 0); ?>', //初始化当前页
        jump:function (e,first) {
            var total = '<?php echo e($lists['total']); ?>';
            var totalPage= '<?php echo e($lists['totalPage']); ?>';
            var paginate = $('#paginate').val();
            if(e.curr > Math.ceil( total / paginate)){
                e.curr = Math.ceil( total / paginate);
            }
            if (!first){
                window.location.href = '<?php echo e($lists['url'] . '?page='); ?>' + e.curr + '&paginate=' + paginate + '&' + '<?php echo e(http_build_query($query)); ?>';
            }
        }
    });

    $(".go").click(function () {
        var paginate = $('#paginate').val();
        window.location.href = '<?php echo e($lists['url']); ?>' + '?paginate=' + paginate;
    });

    function deleteChannel (id) {
        if(id){
            var index = layer.confirm('您是否确定要删除选中的条目？', {
                btn: ['确认','取消'] //按钮
            }, function(){
                request('/nonPublicVersion/game/'+id,function (data) {
                    layer.close(index);
                    $("#btn-refresh").click();
                },{},'DELETE');
            });
        } else {
            layer.confirm('该游戏未进行配置,无法删除', {
                btn: ['确定','取消'], //按钮
            });
        }

    }

    function del() {
        var objs = $("input[name='ids[]']");
        var arr = [];
        $.each(objs,function (k,v) {
            if ($(this).is(':checked')){
                var val = $(this).val();
                arr.push(val);
            }
        });
        if(arr == ''){
            layer.alert('请选择要删除的条目');
            return;
        }
        var index = layer.confirm('您是否确定要删除选中的条目？', {
            btn: ['确认','取消'] //按钮
        }, function(){
            request('/nonPublicVersion/game/'+arr[0],function (data) {
                layer.close(index);
                $("#btn-refresh").click();
            },{ids:arr.toString()},'DELETE');
        });
    }
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>